﻿using System;

namespace NClass.StubLanguage
{
	public class StubMethod : Core.Method
	{
		public StubMethod(Core.CompositeType parent) : base("NewMethod", parent) { }

		private bool _isOperator = false;
		public override bool IsOperator { get { return _isOperator; } }

		public override string Name
		{
			get { return base.Name; }

			set
			{
				base.Name = value;
				_isOperator = !string.IsNullOrWhiteSpace(value) && value.Contains("operator");
			}
		}

		public override Core.Operation Clone(Core.CompositeType newParent)
		{
			return new StubMethod(newParent);
		}

		protected override string DefaultType { get { return "object"; } }

		public override Core.Language Language { get { return StubLanguage.Instance; } }

		public override void InitFromString(string declaration)
		{
			// Do Nothing
		}

		public override string GetDeclaration()
		{
			return Name;
		}

		protected override void CopyFrom(Core.Member member)
		{
			if (member == null)
				throw new ArgumentNullException("member");
			base.CopyFrom(member);
		}
	}
}
